<style lang="less">
  @import './login.less';
</style>

<template>
  <div class="login">
    <div class="login-con">
      <Card icon="log-in" title="欢迎登录" :bordered="false">
        <div class="form-con">
          <login-form @on-success-valid="handleSubmit"></login-form>
          <p class="login-tip">输入任意用户名和密码即可</p>
        </div>
      </Card>
    </div>
  </div>
</template>

<script>
import LoginForm from '_c/login-form'

// import { login } from '@/api/user.js'

import axios from 'axios'
import { mapActions } from 'vuex'
export default {
  components: {
    LoginForm
  },
  methods: {
    ...mapActions([
      'handleLogin',
      'getUserInfo'
    ]),
    handleSubmit ({ userName, password }) {
      axios.post('/login', {
        userName,
        password
      })
        .then(function (response) {
          console.log(response, 'llllllll')
        })
        .catch(function (error) {
          console.log(error)
        })

        // console.log(userName, password, '2222222222');
        // login({ userName, password }).then(res => {
        //   console.log(res, '登录');
        // })

        // this.handleLogin({ userName, password }).then(res => {
        //   this.getUserInfo().then(res => {
        //     this.$router.push({
        //       name: this.$config.homeName
        //     })
        //   })
        // })
    }
  }
}
</script>

<style>

</style>
